// ProgressUtils.h

#ifndef __PROGRESSUTILS_H
#define __PROGRESSUTILS_H

#include "Common/COM/ICoder.h"
#include "IProgress.h"

class ATL_NO_VTABLE CLocalProgress :
	public CComObjectRootEx<CComSingleThreadModel>,
  public ICompressProgressInfo 
{
  CComPtr<IProgress> _progress;
  CComPtr<ICompressProgressInfo> _ratioProgress;
  bool _inSizeIsMain;
public:
	BEGIN_COM_MAP(CLocalProgress)
		COM_INTERFACE_ENTRY(ICompressProgressInfo)
	END_COM_MAP()


	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}

	void FinalRelease()
	{
	}

  UINT64 ProgressOffset;
  UINT64 InSize;
  UINT64 OutSize;
  bool SendRatio;
  bool SendProgress;

  CLocalProgress();
  void Init(IProgress *progress, bool inSizeIsMain);
  HRESULT SetCur();


  STDMETHOD(SetRatioInfo)(const UINT64 *inSize, const UINT64 *outSize);
};

#endif
